//package com.senta.elasticsearch.listener;
//
//import com.alibaba.fastjson.JSON;
//import com.senta.elasticsearch.entity.BillingItemDis;
//import com.senta.elasticsearch.repository.BillingItemDisRepository;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.rocketmq.common.message.MessageExt;
//import org.apache.rocketmq.spring.annotation.MessageModel;
//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
//import org.apache.rocketmq.spring.core.RocketMQListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
//import org.springframework.stereotype.Component;
//
//import java.time.LocalDateTime;
//
///**
// * Created by anyang
// * Email: 1300378587@qq.com
// * Created Date:2019-11-12 09:48
// */
//
//@Slf4j
//@Component
//@RocketMQMessageListener(topic = "${rocketmq.topic}",consumerGroup = "${rocketmq.consumer.group}",messageModel = MessageModel.BROADCASTING)
////订阅主题= "springboot-rocketmq"，消费者组， messageModel：消费模式【广播，负载均衡】
//public class Cusumer implements RocketMQListener<MessageExt>{
//    @Autowired
//    BillingItemDisRepository billingItemDisRepository;
//    @Override
//    public void onMessage(MessageExt message){
//        String msgId = message.getMsgId();
//        String body = new String(message.getBody());
//        BillingItemDis billingItemDis = JSON.parseObject(body, BillingItemDis.class);
//        billingItemDisRepository.save(billingItemDis);
//        log.info("收到消息:: "+msgId);
//        //创建对象保存进程的情况
//
//        log.info("保存消息:: "+message+" "+(false?"成功":"失败")+ LocalDateTime.now());
//
//    }
//}
//
